package table.view;

import java.awt.BorderLayout;
import java.awt.Component;

import javax.swing.JLabel;
import javax.swing.JTable;

import table.model.rowModel.ColumnDirection;

public class ArrowedHeaderRenderer extends MultiLineHeaderRenderer {

	private Arrow arrow;
	private JLabel arrowComp;
	
	public ArrowedHeaderRenderer() {
		super();
		arrow =  new Arrow(ColumnDirection.NOT_SORTED);
		arrowComp = new JLabel(arrow);
		add(arrowComp,BorderLayout.EAST);
	}
	
	@Override
	public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
		arrow.setSize(table.getTableHeader().getFont().getSize());
		return super.getTableCellRendererComponent(table, value, isSelected, hasFocus,
				row, col);
	}
	
	public void setArrowState(int arrowState) {
		arrow.setDirection(arrowState);
	}
}
